package com.dji.ux.sample.Utils;
import java.util.ArrayList;
import java.util.List;

import dji.common.mission.waypoint.Waypoint;
import dji.common.mission.waypoint.WaypointMissionFinishedAction;
import dji.common.mission.waypoint.WaypointMissionHeadingMode;


public class JSONUtil {
    /**Waypoint任务完成之后的操作*/
    private static WaypointMissionFinishedAction mFinishedAction = WaypointMissionFinishedAction.NO_ACTION;
    /**Waypoint镜头朝向*/
    private static WaypointMissionHeadingMode mHeadingMode = WaypointMissionHeadingMode.AUTO;

    private static List<Waypoint> mWayPointList = new ArrayList<>();

    public static WaypointMissionFinishedAction getFinishAction(int finishAction){
        switch (finishAction){
            case 0:
                mFinishedAction = WaypointMissionFinishedAction.NO_ACTION;
                break;
            case 1:
                mFinishedAction = WaypointMissionFinishedAction.GO_HOME;
                break;
            case 2:
                mFinishedAction = WaypointMissionFinishedAction.AUTO_LAND;
                break;
            case 3:
                mFinishedAction = WaypointMissionFinishedAction.GO_FIRST_WAYPOINT;
                break;
        }
        return mFinishedAction;
    }

    public static WaypointMissionHeadingMode getHeadMode(int headMode) {
        switch (headMode){
            case 0:
                mHeadingMode = WaypointMissionHeadingMode.AUTO;
                break;
            case 1:
                mHeadingMode = WaypointMissionHeadingMode.USING_INITIAL_DIRECTION;
                break;
            case 2:
                mHeadingMode = WaypointMissionHeadingMode.CONTROL_BY_REMOTE_CONTROLLER;
                break;
            case 3:
                mHeadingMode = WaypointMissionHeadingMode.USING_WAYPOINT_HEADING;
                break;
        }
        return mHeadingMode;
    }

    public static float getAltitude(String altitude) {
        return Float.parseFloat(altitude);
    }

    public static float getSpeed(String mSpeed){
        return Float.parseFloat(mSpeed);
    }

    public static List<Waypoint> getWaypointList(String waypointList){


        return mWayPointList;
    }
}
